package com.itcodai.controller.course04;

import com.itcodai.config.MicroServiceUrl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

import javax.annotation.Resource;

/**
 * @author c-fanqj
 * @date 2023/3/22
 * @apiNote
 */
//@RestController
//@RequestMapping("/test")
public class ConfigController {

    private static final Logger logger =
            LoggerFactory.getLogger(ConfigController.class);

    @Resource
    private MicroServiceUrl microServiceUrl;

    @Value("${url.orderUrl}")
    private String orderUrl;

    //@RequestMapping("/config")
    public String testConfig() {
        logger.info("=====获取的订单服务地址为：{}", orderUrl);
        // 使用配置类来获取
        logger.info("=====获取的订单服务地址为：{}", microServiceUrl.getOrderUrl());
        logger.info("=====获取的用户服务地址为：{}", microServiceUrl.getUserUrl());
        logger.info("=====获取的购物车服务地址为：{}", microServiceUrl.getShoppingUrl());
        return "success";
    }

}
